

FLAGS = -arch i386 \
  -F/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks

CFLAGS = $(FLAGS) -Wall \
  -Ilibs/irrKlang-1.3.0/include \
  -Ilibs/freetype-2.4.6/include \
  -Ilibs/SOIL/src

LFLAGS = $(FLAGS) \
  -isysroot /Developer/SDKs/MacOSX10.6.sdk \
  -lstdc++ \
  -framework CoreFoundation \
  -framework GLUT \
  -framework OpenGL \
  -Llibs/irrKlang-1.3.0/bin/macosx-gcc \
  -lirrklang \
  -Llibs/freetype-2.4.6/install/lib \
  -lfreetype \
  -Llibs/SOIL/lib \
  -lSOIL


CC = gcc
COMPILE = $(CC) $(CFLAGS) -c
LINK = $(CC) $(LFLAGS)
INPUT = $(wildcard game/*.cpp)
OBJFILES := $(patsubst %.cpp,%.o,$(INPUT))
EXECUTABLE = jammer


all: jammer


jammer: $(OBJFILES)

	$(LINK) -o $(EXECUTABLE) $(OBJFILES)
	install_name_tool -change /usr/local/lib/libfreetype.6.dylib ./libs/freetype-2.4.6/install/lib/libfreetype.dylib jammer
	install_name_tool -change /usr/local/lib/libirrklang.dylib libs/irrKlang-1.3.0/bin/macosx-gcc/libirrklang.dylib jammer


%.o: %.cpp

	$(COMPILE) -o $@ $<


clean:

	rm $(OBJFILES)
	rm $(EXECUTABLE)

